

import React from 'react'

import {withRouter} from 'react-router-dom'

import PropTypes from 'prop-types'

import {NavBar,} from 'antd-mobile'




// 导入 CSS Modules 修改 NavHeader样式
import styles from './index.module.css'

 function    NavHeader({children,history,onLeftClickEvt}) {

    //  默认点击行为
    const defaultHandeler  =  ()=>history.go(-1)
  return (
    <NavBar
  
    className={styles.navBar}
    mode="light"
    icon={<i  className='iconfont  icon-back'></i>}
    onLeftClick={onLeftClickEvt ||  defaultHandeler}
   
  >{children}</NavBar>

  )
}


// 添加props校验
NavHeader.propTypes = {
    children: PropTypes.string.isRequired,
    onLeftClick: PropTypes.func
  }


export default    withRouter(NavHeader)